Alexander Larsson [Mon, 10 Feb 2020 12:30:57 +0000 (13:30 +0100)]
Fix typo in GtkIconPaintable is-symbolic property
Alexander Larsson [Mon, 10 Feb 2020 12:12:26 +0000 (13:12 +0100)]
icon-theme: Add back and fix test for handling non-square icons
We test this by looking at the produced render nodes now that
we don't actualluy scale the icon. Also, it turns out that this
code was broken due to some typos, so we also fix those.
Alexander Larsson [Mon, 10 Feb 2020 11:57:27 +0000 (12:57 +0100)]
Expose gtk_icon_paintable_new_for_file
Alexander Larsson [Mon, 10 Feb 2020 11:51:27 +0000 (12:51 +0100)]
GtkIconPaintable: Add properties for file, icon-name and is-symbolic
Alexander Larsson [Mon, 10 Feb 2020 11:33:17 +0000 (12:33 +0100)]
icon paintable: Replace get_filename and get_resource_path with get_file()
This returns a GFile which can represent both the above.
Alexander Larsson [Mon, 10 Feb 2020 10:43:47 +0000 (11:43 +0100)]
Rename GTK_ICON_LOOKUP_LOAD_IN_THREAD to GTK_ICON_LOOKUP_PRELOAD
Alexander Larsson [Mon, 10 Feb 2020 10:40:00 +0000 (11:40 +0100)]
icontheme: Always return some icon name in get_icon_name() for lookup results
If you called gtk_icon_theme_lookup(), then always return some useful
icon name from gtk_icon_paintable_get_icon_name(), even if we picked
an unthemed icon.
Also rewrite the gtk_icon_paintable_get_icon_name() docs to make this
clearer.
Alexander Larsson [Fri, 7 Feb 2020 16:26:22 +0000 (17:26 +0100)]
GtkIconHelper: Trigger preload when css sizes is valid
When the css is validated we know the css size, so we can
create the paintable at that point, and we do so passing the
LOAD_IN_THREAD flag.
This causes us to load most icons early on, in parallel instead of
during the first snapshot.
Alexander Larsson [Fri, 7 Feb 2020 16:25:18 +0000 (17:25 +0100)]
icon-theme: Add GTK_ICON_LOOKUP_LOAD_IN_THREAD flag
This causes lookup to trigger a thread that loads the icon texture.
Alexander Larsson [Fri, 7 Feb 2020 10:54:00 +0000 (11:54 +0100)]
icontheme: Optimize memory use and lookup speed by internalizing icon names
Instead of having the IconTheme have a hashtable that owns
individual strings and then IconThemeDirSize have a similar
hash (but with the strings owned by the other hash), we
have a consecutive memory chunks where we store the icon names
and then the hashtable has pointers into this.
This means we can avoid a bunch of individual strdup()s in a
way that is less fragmented and wastes less space. Additionally,
since we do an initial lookup anyway we have the internalized
icon name during lookup which means we can use g_direct_hash/equal
instead of g_str_hash/equal making the lookup faster too.
Alexander Larsson [Fri, 7 Feb 2020 07:44:46 +0000 (08:44 +0100)]
Remove stray space
Alexander Larsson [Fri, 7 Feb 2020 07:44:29 +0000 (08:44 +0100)]
Use G_OBJECT_TYPE_NAME instead of g_type_name_from_instance
Alexander Larsson [Thu, 6 Feb 2020 16:33:19 +0000 (17:33 +0100)]
Add gtk_icon_paintable_get_resource_path()
Also, return NULL from gtk_icon_paintable_get_filename() if the path
is really a resource path.
Alexander Larsson [Thu, 6 Feb 2020 16:28:19 +0000 (17:28 +0100)]
Add gtk_icon_paintable_get_icon_name()
This allows you to see which icon was actually chosen.
Alexander Larsson [Thu, 6 Feb 2020 16:14:44 +0000 (17:14 +0100)]
Remove gtk_icon_paintable_download_texture() public API
This allows us do do what we want internally, and anyway it didn't
really do what you'd expect anymore now that we do resizing during
rendering.
Alexander Larsson [Thu, 6 Feb 2020 16:10:13 +0000 (17:10 +0100)]
Replace last users of gtk_icon_paintable_download_texture ()
These now render the paintable to a cairo surface and convert that
to a texture. This is sort of a hack, but its only used in two
special cases internally and in two hacky test apps.
Alexander Larsson [Thu, 6 Feb 2020 15:33:34 +0000 (16:33 +0100)]
textview: Use paintables instead of textures, and fix the support
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
Alexander Larsson [Thu, 6 Feb 2020 15:23:11 +0000 (16:23 +0100)]
gtk_css_style_snapshot_icon_paintable: Fix uninitialized memory access
We were reading the foreground color alpha even when we didn't read it.
Alexander Larsson [Thu, 6 Feb 2020 15:21:54 +0000 (16:21 +0100)]
GskPango: Allow specifying a custom shape snapshot handler
We will need this for GtkTextView to render the textures in it.
Alexander Larsson [Thu, 6 Feb 2020 09:28:12 +0000 (10:28 +0100)]
GtkBuilder: Directly load the fallback missing image
No need for all this complexity with the icon theme, especially when
its now a lot more work to get the texture back. We can just load
the pixbuf.
Alexander Larsson [Thu, 6 Feb 2020 09:27:02 +0000 (10:27 +0100)]
icontheme: Move IMAGE_MISSING_RESOURCE_PATH to (private) header
This way other code can use this resource too for fallbacks, avoing
having to go through the icon theme.
Alexander Larsson [Thu, 6 Feb 2020 09:26:26 +0000 (10:26 +0100)]
icontheme: Handle GEmblemIcon in lookup_by_gicon()
Alexander Larsson [Thu, 6 Feb 2020 09:17:13 +0000 (10:17 +0100)]
icon theme: Also never fail in gtk_icon_theme_lookup_by_gicon()
Similar to regular lookups, if the icon is some unknown type we return
a missing-image.
Alexander Larsson [Thu, 6 Feb 2020 08:50:04 +0000 (09:50 +0100)]
Remove unnecessary image-missing fallbacks
We now always return something from icon theme lookups, so no need to
do custom fallbacks.
Alexander Larsson [Thu, 6 Feb 2020 08:45:03 +0000 (09:45 +0100)]
icon-theme: Don't pre-scale pixbufs in gtk_icon_theme_lookup_by_gicon
We do scaling during rendering now anyway.
Alexander Larsson [Wed, 5 Feb 2020 16:08:29 +0000 (17:08 +0100)]
IconTheme: Never fail a lookup or icon load
If icon lookup fails or if loading it fails later, just always
fall back to the built in image-missing icon. Nobody is handling
missing icons in a sane way anyway.
If you *truly* need to handle missing icons, you need to manually
use gtk_icon_theme_has_icon().
While changing the loading code I also fixed an issue where it
was always passing "png" to pixbuf, now it also handles "xpm" if
that is the filename suffix.
Alexander Larsson [Wed, 5 Feb 2020 16:44:47 +0000 (17:44 +0100)]
Support aspect=TRUE in _gdk_pixbuf_new_from_stream_at_scale
The icon theme test failed without this, and we *should* handle
it if we're accepting the argument.
Alexander Larsson [Wed, 5 Feb 2020 14:47:23 +0000 (15:47 +0100)]
IconTheme: Simplify icon scaling
We had a pretty complex setup where we tried to avoid scaling up themes from dirs
that specified a size. However, not only was it very complex, but it didn't quite
work with window scales, because when using e.g. a size 32 directory for 16@2x
the dir size is wrong anyway. Additionally it turns out most code either picks
an existing icon size, or uses the FORCE_SIZE flags, so it doesn't seem
like a useful behaviour.
This change drops the FORCE_SIZE flags, and always scales
icons. Additionally it moves the scaling of the icon to rendering,
which seems more modern, and allows us to (later) share icons loaded
for different sizes that happened to use the same source file (at
different scales).
Note that this changes the behaviour of
gtk_icon_paintable_download_texture() is it now returns the unscaled
source icon. However, ignore thats, as I plan to remove this function
and replace it with a way to render a paintable to a cairo-surface
instead.
Alexander Larsson [Wed, 5 Feb 2020 08:49:23 +0000 (09:49 +0100)]
GtkIconPaintable: Always recolor when snapshotting.
It never makes sense to paint a texture that needs recoloring. If
you call the regular snapshot on a symbolic texture we just use the
default recoloring colors.
To support this we also change gtk_css_style_snapshot_icon_paintable()
to call gtk_icon_paintable_snapshot_with_colors() for IconPaintables
so that we get the correct colors, and we make it not emit the color
matrix.
Since we now rely on the icon to do the recoloring we also drop the
recolor argument in gtk_icon_paintable_snapshot_with_colors() as its
not needed anymore.
Alexander Larsson [Wed, 5 Feb 2020 08:30:47 +0000 (09:30 +0100)]
icontheme: Align function arguments
Matthias Clasen [Thu, 6 Feb 2020 06:38:17 +0000 (06:38 +0000)]
Merge branch 'kill-simple-search' into 'master'
Remove simple search engine
See merge request GNOME/gtk!1393
Matthias Clasen [Thu, 6 Feb 2020 04:53:07 +0000 (04:53 +0000)]
Merge branch 'better-test-isolation-2' into 'master'
Better test isolation
See merge request GNOME/gtk!1391
Matthias Clasen [Thu, 6 Feb 2020 04:35:39 +0000 (23:35 -0500)]
css tests: Ignore ".csd" vs ".solid-csd"
It it hard to control which of the csd style classes we get,
since it depends on details of the X server or compositor.
Explicitly ignore this difference by replacing .solid-csd
with .csd in the output.
Matthias Clasen [Thu, 6 Feb 2020 03:24:39 +0000 (22:24 -0500)]
testsuite: Make tests run without a11y bus
Not having an a11y bus around causes warnings from
at-spi, which make tests fail. Explicitly ignore those
warnings.
Matthias Clasen [Thu, 6 Feb 2020 03:23:52 +0000 (22:23 -0500)]
testsuite: Fix bloomfilter style tests
The results were expecting solid-csd, which is not what
we usually have.
Matthias Clasen [Wed, 5 Feb 2020 18:26:22 +0000 (18:26 +0000)]
Merge branch 'master.msvc' into 'master'
Fix building recent GTK master on Visual Studio
See merge request GNOME/gtk!1369
Matthias Clasen [Wed, 5 Feb 2020 18:04:42 +0000 (18:04 +0000)]
Merge branch 'public-emojichooser' into 'master'
emojichooser: Make public
See merge request GNOME/gtk!1382
Benjamin Otte [Wed, 5 Feb 2020 14:04:12 +0000 (14:04 +0000)]
Merge branch 'wip/otte/css' into 'master'
Some CSS cleanup
See merge request GNOME/gtk!1389
Matthias Clasen [Tue, 4 Feb 2020 23:47:42 +0000 (00:47 +0100)]
emojichooser: Add profiler marks for loading
This is a long-running operation, and worth showing
in traces.
Matthias Clasen [Tue, 4 Feb 2020 23:25:15 +0000 (00:25 +0100)]
icontheme: Fix various memory leaks
Tasks need to be unreffed too.
Matthias Clasen [Tue, 4 Feb 2020 23:24:14 +0000 (00:24 +0100)]
widget: Fix a memory leak with class actions
This code was doing the wrong thing even if the parent class
doesn't have actions.
Matthias Clasen [Tue, 4 Feb 2020 23:23:36 +0000 (00:23 +0100)]
Add a lib64 variant of gtk.supp
Matthias Clasen [Tue, 4 Feb 2020 22:41:00 +0000 (23:41 +0100)]
icontheme: Remove some dead code
Matthias Clasen [Tue, 4 Feb 2020 22:07:43 +0000 (23:07 +0100)]
frameclock: cosmetics
Redo the profiler marks for the frame clock signals
to look more uniform.
Matthias Clasen [Tue, 4 Feb 2020 21:54:19 +0000 (22:54 +0100)]
gdk: Silence some compiler warnings
These cause unused variable warnings in release builds.
Matthias Clasen [Tue, 4 Feb 2020 21:45:29 +0000 (22:45 +0100)]
treestore: Silence compiler warnings
This was causing compiler warnings in release builds.
Matthias Clasen [Tue, 4 Feb 2020 21:42:44 +0000 (22:42 +0100)]
notebook: Don't trigger criticals in dispose
When we dismantle our children in dispose, we
trigger a11y children-changed signals which end
up calling back into the notebook. Handle this
without critical warnings.
Matthias Clasen [Tue, 4 Feb 2020 21:40:11 +0000 (22:40 +0100)]
textview: Don't update action state in dispose
Only update the action state when we have a text buffer,
there is no need to do it otherwise, since we are going
to get a buffer before we get shown. This avoids triggering
the action state updates from finalize, which is a bad
time to be recreating the action muxer.
Matthias Clasen [Tue, 4 Feb 2020 21:15:32 +0000 (22:15 +0100)]
entry: Avoid criticals in dispose
The accessible gets properties of the entry, and
resetting the entry icons triggers accessible change
notification, so do that before we dismantle the entry
too far to respond to a g_object_get () call.
Matthias Clasen [Tue, 4 Feb 2020 19:01:56 +0000 (20:01 +0100)]
Don't export color picker functions
This is not public API, so it shouldn't be exported.
Matthias Clasen [Tue, 4 Feb 2020 16:54:30 +0000 (17:54 +0100)]
Read bookmarks async
Do not block the main thread while reading the bookmarks file.
This speeds up initial setup of a GtkPlacesSidebar.
Matthias Clasen [Tue, 4 Feb 2020 15:26:40 +0000 (16:26 +0100)]
placessidebar: Change some initial property values
Giving these properties the initial value that the file
chooser wants for them avoids some calls to update_places
in the setup code.
Matthias Clasen [Wed, 5 Feb 2020 05:45:35 +0000 (00:45 -0500)]
testperf: More flexible mark selection
Allow selecting marks not just by their name, but
also by the message detail.
Matthias Clasen [Wed, 5 Feb 2020 05:23:13 +0000 (00:23 -0500)]
testperf: Allow measuring start time
This can be used e.g. to measure how long it takes us
to get the first frame on screen.
Benjamin Otte [Wed, 5 Feb 2020 03:02:57 +0000 (04:02 +0100)]
stylecontext: Remove unused typedef
Timm Bäder [Tue, 4 Feb 2020 09:17:15 +0000 (10:17 +0100)]
css: Make some local variables const
Timm Bäder [Tue, 28 Jan 2020 13:48:10 +0000 (14:48 +0100)]
css: Remove unused function
Timm Bäder [Mon, 3 Feb 2020 09:59:21 +0000 (10:59 +0100)]
style context: Remove parent relationship
We don't have foreign drawing anymore, so we don't need this.
Benjamin Otte [Wed, 5 Feb 2020 02:12:40 +0000 (03:12 +0100)]
stylecontext: Remove gtk_style_context_new()
It's private now, no more foreign drawing of any sort.
To be fair, it was entirely useless without widget paths already.
Benjamin Otte [Wed, 5 Feb 2020 01:59:11 +0000 (02:59 +0100)]
testsuite: Remove the stylecontext test
Stylecontexts are on their way out and I'm removing API that the
testsuite was relying on, so remove the tests.
Put the useful parts of the tests elsewhere.
Benjamin Otte [Wed, 5 Feb 2020 01:54:32 +0000 (02:54 +0100)]
stylecontext: Remove the "changed" signal
Instead, always go directly to the GtkWidget::css_changed() call.
Benjamin Otte [Wed, 5 Feb 2020 01:46:13 +0000 (02:46 +0100)]
widget: Replace style-updated signal with css_changed vfunc
1. Rename the thing
2. Turn it from a signal to a vfunc
3. Pass the GtkCssStyleChange to it
We don't export any public API about the GtkCssStyleChange yet, it's
just a boring opaque struct.
Benjamin Otte [Tue, 4 Feb 2020 23:18:41 +0000 (00:18 +0100)]
pathbar: Remove unneeded code
The icons here are GIcons, they don't depend on the theme.
Benjamin Otte [Tue, 4 Feb 2020 22:24:50 +0000 (23:24 +0100)]
cssnode: Remove redundant check
We assert that cssnode->parent is NULL, no need to check it again.
Benjamin Otte [Tue, 4 Feb 2020 17:48:58 +0000 (17:48 +0000)]
Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master
See merge request GNOME/gtk!1388
Timm Bäder [Mon, 27 Jan 2020 13:21:44 +0000 (14:21 +0100)]
widget: Skip not-drawable widgets in snapshot_child
Otherwise we transform the snapshot just to not do anything.
Matthias Clasen [Thu, 19 Dec 2019 02:56:57 +0000 (21:56 -0500)]
maplistmodel: Add an example to the docs
Matthias Clasen [Thu, 19 Dec 2019 03:41:41 +0000 (22:41 -0500)]
treelistmodel: Small documentation tweaks
Benjamin Otte [Tue, 4 Feb 2020 16:33:14 +0000 (17:33 +0100)]
widgetfocus: Remove unnecessary check
Mapped widgets are always realized.
Benjamin Otte [Tue, 4 Feb 2020 16:31:18 +0000 (17:31 +0100)]
widget: Remove _gtk_widget_is_drawable()
Use _gtk_widget_get_mapped() instead.
Drawable checked visible && mapped and mapped widgets are always
visible, so that was an unnecessary check.
Benjamin Otte [Tue, 4 Feb 2020 16:36:46 +0000 (16:36 +0000)]
Merge branch 'wip/otte/icontheme' into 'master'
Do simple icontheme API cleanups
See merge request GNOME/gtk!1378
Alexander Larsson [Tue, 4 Feb 2020 16:19:22 +0000 (17:19 +0100)]
Rename GtkIcon to GtkIconPaintable
Benjamin Otte [Tue, 4 Feb 2020 16:07:38 +0000 (17:07 +0100)]
tooltip: Don't css-validate
That's a job for toplevels now.
See
17ca95a1617b009a76b27a8572671855435985e7 for the same comit on
popovers.
Benjamin Otte [Tue, 4 Feb 2020 03:26:19 +0000 (04:26 +0100)]
icontheme: Remove GENERIC_FALLBACKS
Instead, rely on people passing fallbacks explicitly.
Alternatively, GThemedIcon provides the functionality to create
fallbacks, which is what GtkImage and the testsuite now use.
That method is slightly better, too, so the expected test results
have been updated accordingly.
Benjamin Otte [Tue, 4 Feb 2020 02:53:22 +0000 (03:53 +0100)]
icontheme: Pass fallbacks as optional argument to lookup_icon()
This way, we can remove gtk_icon_theme_choose_icon() completely.
Benjamin Otte [Sun, 2 Feb 2020 00:19:50 +0000 (01:19 +0100)]
icontheme: Remove contexts
There is no way to query contexts or do anything useful with them.
So don't keep track of them and don't make them an argument in public
APIs with the docs saying "I don't know what to use here, maybe read
some spec somewhere".
Benjamin Otte [Sun, 2 Feb 2020 00:13:27 +0000 (01:13 +0100)]
icontheme: Clean up includes
Benjamin Otte [Sun, 2 Feb 2020 00:05:42 +0000 (01:05 +0100)]
icontheme: Remove gtk_icon_get_base_size() and gtk_icon_get_base_dir()
Those functions are unused and the documentation says "Returns some
random number that the icon theme creator chose" which does not seem at
all useful and an implementation detail.
So get rid of it.
Benjamin Otte [Sat, 1 Feb 2020 23:56:39 +0000 (00:56 +0100)]
Revert "Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()"
We're not in the business of adding Cairo APIs. That's Cairo's job.
Also, we don't need this API anywhere like the original commit claimed,
so there's no need to make it available in any way.
This reverts commit
afa6cc23692f83f0d38de24c9cf58a7a494c01d2.
Benjamin Otte [Sat, 1 Feb 2020 23:48:24 +0000 (00:48 +0100)]
icontheme: Remove crayon APIs
We expose no API to get at any colors for drawing symbolics, so we
shouldn't have APIs to draw with them.
Apart from that, those APIs look like a box of crayons, not like an
icontheme.
Benjamin Otte [Sat, 1 Feb 2020 23:44:01 +0000 (00:44 +0100)]
icontheme: Remove gtk_icon_theme_rescan_if_needed()
If the icon theme needs to be rescanned, it should just do it.
If it doesn't, there's no need for this function.
Ergo: Don't have the function.
Benjamin Otte [Sat, 1 Feb 2020 23:42:43 +0000 (00:42 +0100)]
icontheme: Remove NO_SVG and FORCE_SVG flags
If the icon theme loads SVGs or not is an implementation detail and
should not be exposed in public API.
Benjamin Otte [Sat, 1 Feb 2020 23:35:42 +0000 (00:35 +0100)]
icontheme: Remove GTK_ICON_LOOKUP_USE_BUILTIN
It's unused.
Benjamin Otte [Sat, 1 Feb 2020 23:27:14 +0000 (00:27 +0100)]
icontheme: Make text direction a lookup argument
Most users were just forgetting to set the proper flags.
And flags aren't the right way to set this anyway, it was just
acceptable as a workaround during GTK3 to not break API.
Benjamin Otte [Sat, 1 Feb 2020 22:51:04 +0000 (23:51 +0100)]
icontheme: Remove async APIs
Widgets would not use them properly. In fact, the only user was using
them wrong.
As icons are loaded async by default, this call isn't necessary.
Benjamin Otte [Sat, 1 Feb 2020 22:38:49 +0000 (23:38 +0100)]
icontheme: Remove gtk_icon_theme_get_default()
The API encouraged wrong usage - most of the users were indeed wrong.
Use the correct version instead:
gtk_icon_theme_get_for_display (gtk_widget_get_display ())
Alexander Larsson [Tue, 4 Feb 2020 14:01:48 +0000 (15:01 +0100)]
a11y tests: Ignore "active" flag on toplevel
All the a11y tests were failing for me with a window state diff
like this:
- state: active enabled resizable sensitive showing visible
+ state: enabled resizable sensitive showing visible
I guess the windows in the CI always gets the focus, but not when
I run it here. Generally focus seems asynchronous and hard to rely
on so I just made the test ignore the active state on toplevels.
Alexander Larsson [Tue, 4 Feb 2020 13:13:33 +0000 (14:13 +0100)]
tests: Initialize dbus before gtk
These days initilizing gtk may create a connection to the sesson bus,
so we have to initialize GTestDBus before initalizing gtk, or we'll
use the address of the "real" session bus (and remember that in the
global).
To further muck things up, g_test_dbus_up() resets important env
vars like DISPLAY and XDG_RUNTIME_DIR, which we have to re-set.
Alexander Larsson [Tue, 4 Feb 2020 13:08:10 +0000 (14:08 +0100)]
filechooser portal: Free portal proxy when bus connection closes
This was blocking the clean exit from the testdbus shutdown in
the defaultvalues test. The proxy was keeping the connection alive
which blocks g_test_dbus_down().
Matthias Clasen [Tue, 4 Feb 2020 11:19:23 +0000 (12:19 +0100)]
css: Fix the initial values optimization
Fix up the index computation. We have duplicate entries
in the type enum, so to go from one of the 'initial' types
to it corresponding type you subtract one, but to find
the size array entry for a type, you divide by 2.
Matthias Clasen [Tue, 4 Feb 2020 10:51:27 +0000 (10:51 +0000)]
Merge branch 'faster-theme-lookup' into 'master'
Faster icon theme lookup
See merge request GNOME/gtk!1381
Alexander Larsson [Tue, 4 Feb 2020 08:35:20 +0000 (09:35 +0100)]
icon-theme: Only have one copy of the icon flags enum
It turns out with the icon cache now using the virtual SYMBOLIC_PNG_SUFFIX
flag the two enums are now identical, so lets just use one of them, the
one GtkIconCache (so we move it to the header).
Alexander Larsson [Mon, 3 Feb 2020 14:11:35 +0000 (15:11 +0100)]
Don't use xsettings or xft defaults in testsuite
This adds a GDK_DEBUG=default-settings flag which disables reads
from xsettings and Xft resources, and enables this for the testsuite.
This is one less way to get different testresults depending on the
environment. In particular, it was failing the css tests for me
due to getting the wrong font size because i have a different dpi.
Matthias Clasen [Mon, 3 Feb 2020 11:49:36 +0000 (12:49 +0100)]
emojichooser: Make public
This is a useful widget to have, and it has minimal api.
Not having it public forces apps to recreate a lot of
complicated machinery for not good reason, if they need
an Emoji chooser in a different context.
Alexander Larsson [Mon, 3 Feb 2020 10:01:48 +0000 (11:01 +0100)]
GtkIconCache: Remove unused code
We're not really using the icon theme cache much anymore, as the
individual per-directory hashes are no longer used, so delete all the
unused code.
Alexander Larsson [Mon, 3 Feb 2020 09:35:45 +0000 (10:35 +0100)]
IconTheme: Make icon lookups faster
Traditionally the icon lookup for a theme has been:
lookup (icon_name, size):
best_directory = NULL
forearch theme
foreach directory in theme
if dir_size_matches (directory, size) && dir_has_icon (directory, icon-name)
best_directory = chose_best_size_dir (best_directory, directory)
if best_directory
return icon from best_directory
However, it turns out that there are a lot of subdirectories which have the same
size, as they differ only in the (essentially useless) "context" value. For example
the "16x16/apps" subdirectory is essentially the same as the "16x16/actions" one.
So, instead rathern than keeping all the directories as separate we store the
all the directories with the same size as a single entity (DirSize) and the
icon lookup in that DirSize looks up not only which suffix to use for that icon
but also which subdir it is in.
Additionally we keep a hashtable with all icon names that are
available in the entire theme (i.e. all DirSizes), which allows use
both to store each icon name only once, but also to do a quick
negative lookup and early exit in case we're looking up an icon that
doesn't exist. This is pretty common because we often look up sets of
icons like "image-png-symbolic", "image-png", "image", expecting some
to fail.
This brings down the time of the initial css validation from 20msec to 15msec for
me when running icon-factory.
Alexander Larsson [Mon, 3 Feb 2020 09:00:17 +0000 (10:00 +0100)]
icon-cache: Add new function to list all the icons in a directory
This lists the icons in a particular director, with their flags in a
hashtable. We also convert from "icon.symbolic" + SUFFIX_PNG to
"icon" + SUFFIX_SYMBOLIC_PNG.
Chun-wei Fan [Wed, 15 Jan 2020 07:27:59 +0000 (15:27 +0800)]
meson/MSVC builds: Use -utf-8 where available
This avoids the build from erroring out on C4819 (Unicode handling issue in
Visual Studio compiler), notably when running on Chinese, Japanese and
Korean locales.
Also apply -D_USE_MATH_DEFINES, -FImsvc_recommended_pragmas.h and -utf-8 to
the C++ compiler options as well.
Rico Tzschichholz [Mon, 3 Feb 2020 09:51:50 +0000 (10:51 +0100)]
Remove last GtkWidgetPath reference
See
49b47c913389dc395a48c2b19ac409412623c524
Chun-wei Fan [Thu, 30 Jan 2020 14:35:54 +0000 (22:35 +0800)]
demos/widget-factory/widget-factory.c: Include stdlib.h
Include it for exit().